import { request } from '@/utils'
// 获取列表
export function getDicts(query) {
  return request({
    url: 'dict',
    method: 'get',
    params: query,
  })
}

// 获取列表
export function getChildDicts(query) {
  return request({
    url: 'dict/child',
    method: 'get',
    params: query,
  })
}

// 批量获取字典项
export function getSelArrDicts(query) {
  return request({
    url: 'dict/sel/arr',
    method: 'get',
    params: query,
  })
}

// 获取列表
export function getSelDicts(query) {
  return request({
    url: 'dict/sel',
    method: 'get',
    params: query,
  })
}

// 获取详情
export function getDict(dictId, data) {
  return request({
    url: `dict/${dictId}`,
    method: 'get',
    data,
  })
}

export function addDict(data) {
  return request({
    url: 'dict',
    method: 'post',
    data,
  })
}

export function editDict(data) {
  return request({
    url: `dict`,
    method: 'put',
    data,
  })
}

export function deleteDict(dictId) {
  return request({
    url: `dict/${dictId}`,
    method: 'delete',
    data: { dictId },
  })
}
